package com.ccy.legendary.base.pojo;

public enum  PersonStatus {
    
    welcome(0,"加入游戏"),
    prepare(1,"准备"),
    gaming(2,"游戏中"),
    willDie(3,"濒死");
    
    private final int code;

    private final String caption;

    PersonStatus(int code, String caption) {
        this.code = code;
        this.caption = caption;

    }

    public static PersonStatus codeOf(int code) {
        for (PersonStatus personStatus : PersonStatus.values()) {
            if (personStatus.getCode() == code) {
                return personStatus;
            }
        }
        return null;
    }

    public static String getCaption(int code) {
        for (PersonStatus personStatus : PersonStatus.values()) {
            if (personStatus.getCode() == code) {
                return personStatus.caption;
            }
        }
        return null;
    }

    public int getCode() {
        return code;
    }
}
